/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package simhya.model.store.jepstore;

import simhya.model.store.Function;
import java.util.ArrayList;
import simhya.model.store.Store;
import org.nfunk.jep.Variable;
import simhya.matheval.SymbolArray;

/**
 *
 * @author Luca
 */
public class ConstantIncrementFunction implements Function {
    private double increment;
    private int variableID;
    private Store store;
    private Variable[] variables;

    public ConstantIncrementFunction(Store store, int varID, double inc) {
        this.store = store;
        this.variableID = varID;
        this.increment = inc;
        this.store.addExternalFunction(this);
    }


     public void initialize() {
        this.variables = (Variable[])store.getVariables();
    }

    public double compute() {
        return (Double)variables[variableID].getValue() + increment;
    }

    public double compute(SymbolArray vars) {
        throw new UnsupportedOperationException("Not supported yet.");
    }


    public ArrayList<Integer> getVariableList() {
        ArrayList<Integer> list = new ArrayList();
        list.add(variableID);
        return list;
    }


    

}
